<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

//登录路由
Route::any('admin/login', 'Admin\LoginController@login');//登录路由
Route::get('admin/code', 'Admin\LoginController@code');//验证码路由
Route::get('aa','Admin\TestController@zz');//测试关联模型的路由

Route::group(['middleware' => ['admin.login'],'prefix'=>'admin','namespace'=>'Admin'], function () {
    Route::get('index', 'IndexController@index');//后台首页路由
    Route::get('welcome','IndexController@welcome');//欢迎界面iframe
    Route::get('out', 'LoginController@out');//退出路由
    Route::any('change_mima','IndexController@change_mima');//修改密码

    Route::resource('category','CategoryController');//分类控制器的资源路由
    Route::any('cate/order_change','CategoryController@order_change');//排序异步更改路由
    Route::get('cate/create_son/{cid}/{tid}','CategoryController@create_son');//添加子类的路由
    
    Route::resource('type','TypeController');//类型控制器的资源路由

    Route::resource('attr','AttrController');//类型属性资源路由

    Route::resource('goods','GoodsController');//商品的资源路由
//    Route::post('get_attr/{cid}',['uses'=>'GoodsController@get_attr','as'=>'get_attr']);//获得类型属性
    Route::post('get_attr','GoodsController@get_attr');//通过分类获得类型属性的路由
    Route::any('upload_set','GoodsController@upload_set');//处理上传图片的路由
    Route::any('delete_upload_pic','GoodsController@delete_upload_pic');//删除上传图片的路由
});
